/**
 * @description 给一个数组（有序、不重），求缩略区间，力扣228
 * @param {number[]} nums
 * @return {string[]}
 */
var summaryRanges = function (nums) {
    if (nums.length == 0) return [];
    var data = [[nums[0]]];
    for (let i = 1; i < nums.length; i++)
        if (nums[i] - 1 === data[data.length - 1][data[data.length - 1].length - 1])
            data[data.length - 1].push(nums[i]);
        else
            data.push([nums[i]])
    return data.map(v => v[0] === v[v.length - 1] ? v[0] + "" : v[0] + "->" + v[v.length - 1])
};